//package controller;//package com.shuangyang.test.controller;
////
////import java.io.IOException;
////import java.util.Date;
////import java.util.List;
////
////import javax.servlet.http.HttpServletRequest;
////import javax.servlet.http.HttpServletResponse;
////
////import org.apache.log4j.Logger;
////import org.jeecgframework.core.common.controller.BaseController;
////import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
////import org.jeecgframework.core.common.model.json.AjaxJson;
////import org.jeecgframework.core.common.model.json.DataGrid;
////import org.jeecgframework.core.constant.Globals;
////import org.jeecgframework.core.util.MutiLangUtil;
////import org.jeecgframework.core.util.MyBeanUtils;
////import org.jeecgframework.core.util.ResourceUtil;
////import org.jeecgframework.core.util.StringUtil;
////import org.jeecgframework.core.util.oConvertUtils;
////import org.jeecgframework.tag.core.easyui.TagUtil;
////import org.jeecgframework.tag.vo.datatable.SortDirection;
////import org.jeecgframework.web.system.pojo.base.TSUser;
////import org.jeecgframework.web.system.service.SystemService;
////import org.springframework.beans.factory.annotation.Autowired;
////import org.springframework.stereotype.Controller;
////import org.springframework.web.bind.annotation.RequestMapping;
////import org.springframework.web.bind.annotation.ResponseBody;
////import org.springframework.web.servlet.ModelAndView;
////
////import com.alibaba.fastjson.JSONObject;
////
////import cn.fengwoo.tmmobile.entity.AssortmentEntity;
////import cn.fengwoo.tmmobile.entity.AuditEntity;
////import cn.fengwoo.tmmobile.entity.ContentDetailEntity;
////import cn.fengwoo.tmmobile.entity.ContentEntity;
////import cn.fengwoo.tmmobile.entity.LanguageEntity;
////import cn.fengwoo.tmmobile.page.ContentPage;
////import cn.fengwoo.tmmobile.service.AssortmentServiceI;
////import cn.fengwoo.tmmobile.service.AuditServiceI;
////import cn.fengwoo.tmmobile.service.ContentServiceI;
////import cn.fengwoo.tmmobile.service.MemberServiceI;
////import cn.fengwoo.tmmobile.util.WebUtil;
////import cn.fengwoo.tmmobile.util.ckeditor.CKeditorImgUpload;
////import cn.fengwoo.tmmobile.util.constant.FileConstants;
////import cn.fengwoo.tmmobile.util.constant.StatusConstants;
////import cn.fengwoo.tmmobile.util.fileManage.ReadPropertiesUtil;
////import cn.fengwoo.tmmobile.util.upload.Upload;
////
/////**
//// * @Title: Controller
//// * @Description: 消息表
//// * @author zhangdaihao
//// * @date 2018-04-25 15:15:20
//// * @version V1.0
//// *
//// */
////@Controller
////@RequestMapping("/alertController")
////public class AlertController extends BaseController {
////	/**
////	 * Logger for this class
////	 */
////	private static final Logger logger = Logger.getLogger(AlertController.class);
////
////	@Autowired
////	private AuditServiceI auditService;
////	@Autowired
////	private ContentServiceI contentService;
////	@Autowired
////	private SystemService systemService;
////
////	@Autowired
////	private AssortmentServiceI assortmentService;
////	@Autowired
////	private MemberServiceI memberService;
////
////
////
////	/**
////	 * 消息列表 页面跳转
////	 *
////	 * @return
////	 */
////	@RequestMapping(params = "list")
////	public ModelAndView list(HttpServletRequest request) {
////		logger.info("进入消息列表");
////		return new ModelAndView("cn/fengwoo/tmmobile/alert/alertList");
////	}
////
////	/**
////	 * easyui AJAX请求数据
////	 *
////	 * @param request
////	 * @param response
////	 * @param dataGrid
////	 * @param user
////	 */
////
////	@SuppressWarnings("unchecked")
////	@RequestMapping(params = "datagrid")
////	public void datagrid(ContentEntity content,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
////		logger.info("获取消息列表");
////		CriteriaQuery cq = new CriteriaQuery(ContentEntity.class, dataGrid);
////		content.setType("alert");
////		if(oConvertUtils.isEmpty(request.getParameterMap().get("sort"))
////		|| 0 >= request.getParameterMap().get("sort").length){
////			cq.addOrder("createTime", SortDirection.desc);
////			cq.add();
////		}
////		if(oConvertUtils.isNotEmpty(content.getTitle())){
////			cq.in("id", new WebUtil().getIdListByTitle("title", content.getTitle(),
////					                                    "ContentDetailEntity", "contentId", systemService).toArray());
////			cq.add();
////			content.setTitle(null);
////		}
////		if(oConvertUtils.isNotEmpty(content.getAuditor())){
////			cq.in("id", new WebUtil().getIdListByAuditor(content.getAuditor(), "s_content",systemService).toArray());
////			cq.add();
////			content.setAuditor(null);
////		}
////		//查询条件组装器
////		org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, content, request.getParameterMap());
////		this.contentService.getDataGridReturn(cq, true);
////
////		List<ContentEntity> results = dataGrid.getResults();
////		for (ContentEntity contentEntity : results) {
////			contentEntity.setIsAuditor(new WebUtil().isAuditor(request, contentEntity.getCreator(), systemService));
////			contentEntity.setIsCreator(new WebUtil().isCreator(request, contentEntity.getCreator(), systemService));
////			contentEntity.setIsAdmin(new WebUtil().isAdmin(request, contentEntity.getCreator(), systemService));
////			CriteriaQuery v_query = new CriteriaQuery(ContentDetailEntity.class);
////			v_query.eq("contentId",contentEntity.getId());
////			v_query.add();
////			List<ContentDetailEntity> v_details = this.systemService.getListByCriteriaQuery(v_query, false);
////			for(int i = 0; i < v_details.size(); i++){
////				LanguageEntity v_language = this.systemService.get(LanguageEntity.class, v_details.get(i).getLanguageId());
////				if(oConvertUtils.isEmpty(v_language)){
////					continue;
////				}
////				if(request.getSession().getAttribute("lang").equals(v_language.getLangCode().replaceAll("_", "-"))){
////					contentEntity.setTitle(v_details.get(i).getTitle());
////				}
////
////				AuditEntity v_auditor = auditService.getAuditMsg(contentEntity.getId(),"s_content");
////				if (oConvertUtils.isNotEmpty(v_auditor)) {
////					contentEntity.setReason(v_auditor.getReason());
////					contentEntity.setAuditor(v_auditor.getAuditor());
////				}
////			}
////		}
////		dataGrid.setResults(results);
////		TagUtil.datagrid(response, dataGrid);
////	}
////
////	/**
////	 * 删除消息表
////	 *
////	 * @return
////	 */
////	@RequestMapping(params = "del")
////	@ResponseBody
////	public AjaxJson del(ContentEntity content, HttpServletRequest request,Integer delFlg) {
////		String message = null;
////		AjaxJson j = new AjaxJson();
////		content = systemService.getEntity(ContentEntity.class, content.getId());
////		message = MutiLangUtil.getLang("sands.tip.deleteSuc");
////		content.setDelFlg(delFlg);
////		this.systemService.saveOrUpdate(content);
////		systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
////
////		j.setMsg(message);
////		return j;
////	}
////
////
////	/**
////	 * 添加消息表
////	 *
////	 * @param ids
////	 * @return
////	 */
////	@RequestMapping(params = "save")
////	@ResponseBody
////	public AjaxJson save(ContentEntity content, ContentPage contentPage,HttpServletRequest request) {
////		logger.info("保存消息");
////		String message = null;
////		contentPage = new WebUtil().followEnData(contentPage);
////		AjaxJson j = new AjaxJson();
////		TSUser user = ResourceUtil.getSessionUser();
////		if(oConvertUtils.isEmpty(user)){
////			j.setMsg(MutiLangUtil.getLang("sands.tip.pleaseLogin"));
////			j.setSuccess(false);
////			return j;
////		}
////		if (StringUtil.isNotEmpty(content.getId())) {
////			message = MutiLangUtil.getLang("sands.tip.editSuc");
////			ContentEntity t = contentService.get(ContentEntity.class, content.getId());
////			try {
////				MyBeanUtils.copyBeanNotNull2Bean(content, t);
//////				if(!user.getUserName().equals(t.getCreator())){
//////					j.setMsg(MutiLangUtil.getLang("sands.tip.cannotEdit"));
//////					j.setSuccess(false);
//////					return j;
//////				}
////				j = new WebUtil().isContentDataUserful(contentPage);
////				if(!j.isSuccess()){
////					return j;
////				}
////				contentService.saveOrUpdate(t);
////				new WebUtil().saveContentDetail(t,contentPage,systemService,request);
////				systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
////			} catch (Exception e) {
////				e.printStackTrace();
////				message = MutiLangUtil.getLang("sands.tip.updateFai");
////			}
////		} else {
////			content.setCreator(user.getUserName());
////			message = MutiLangUtil.getLang("sands.tip.addSuc");
////			j = new WebUtil().isContentDataUserful(contentPage);
////			if(!j.isSuccess()){
////				return j;
////			}
////			content.setStatus(StatusConstants.NO);
////			content.setCreateTime(new Date());
////			content.setDelFlg(StatusConstants.NO);
////			content.setUpdateTime(new Date());
////			content.setValidTime(new Date());
////			contentService.save(content);
////			new WebUtil().saveContentDetail(content,contentPage,systemService,request);
////			systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
////		}
////		j.setMsg(message);
////		return j;
////	}
////
////	/**
////	 * 消息表列表页面跳转
////	 *
////	 * @return
////	 */
////	@RequestMapping(params = "addorupdate")
////	public ModelAndView addorupdate(ContentEntity content, HttpServletRequest req) {
////		logger.info("编辑或者查看消息");
////		List<AssortmentEntity> v_assortments = this.systemService.loadAll(AssortmentEntity.class);
////		v_assortments = getAssortmentTargetNames(v_assortments);
////		req.setAttribute("assortments", v_assortments);
////		req.setAttribute("assortmentsJson",JSONObject.parse(JSONObject.toJSONString(v_assortments)));
////		req.setAttribute("memberImportTemplate", ReadPropertiesUtil.read("memberImportTemplate"));
////		new WebUtil().getSandsMutilang(req);
////		if (StringUtil.isNotEmpty(content.getId())) {
////			content = contentService.getEntity(ContentEntity.class, content.getId());
////			content = new WebUtil().getWholeContentData(content,systemService,memberService,assortmentService);
////			req.setAttribute("contentPage", content);
////		}
////		return new ModelAndView("cn/fengwoo/tmmobile/alert/alert");
////	}
////
////	/**
////	 * 消息表列表页面跳转
////	 *
////	 * @return
////	 */
////	@RequestMapping(params = "view")
////	public ModelAndView view(ContentEntity content, HttpServletRequest req) {
////		logger.info("编辑或者查看消息");
////		List<AssortmentEntity> v_assortments = this.systemService.loadAll(AssortmentEntity.class);
////		v_assortments = getAssortmentTargetNames(v_assortments);
////		req.setAttribute("assortments", v_assortments);
////		req.setAttribute("assortmentsJson",JSONObject.parse(JSONObject.toJSONString(v_assortments)));
////		if (StringUtil.isNotEmpty(content.getId())) {
////			content = contentService.getEntity(ContentEntity.class, content.getId());
////			content = new WebUtil().getWholeContentData(content,systemService,memberService,assortmentService);
////			req.setAttribute("contentPage", content);
////		}
////		return new ModelAndView("cn/fengwoo/tmmobile/alert/alertSearch");
////	}
////
////
////	/**
////	 * 新闻表列表页面跳转
////	 *
////	 * @return
////	 */
////	@RequestMapping(params = "preview")
////	public ModelAndView preview(ContentPage contentPage, HttpServletRequest req) {
////		TSUser user = ResourceUtil.getSessionUser();
////		if(oConvertUtils.isNotEmpty(user)){
////			req.setAttribute("creator", user.getUserName());
////		}
////		req.setAttribute("contentPage", contentPage);
////		return new ModelAndView("cn/fengwoo/tmmobile/alert/alertPtPreview");
////
////	}
////	/**
////	 * 获得归类的目标名字
////	 * */
////	public List<AssortmentEntity> getAssortmentTargetNames(List<AssortmentEntity> assortments) {
////	    for(int i = 0; i < assortments.size(); i ++){
////	    	assortments.get(i).setTargetNames(this.assortmentService.getDepartmentNames(assortments.get(i).getTarget()));
////	    }
////	    return assortments;
////	}
////	/**
////	 * WebUploader 缩略图上传处理
////	 */
////	@RequestMapping(params = "thumbnailUpload")
////	@ResponseBody
////	public AjaxJson thumbnailUpload(HttpServletRequest request, HttpServletResponse response) {
////		AjaxJson j = new AjaxJson();
////	    String v_url = Upload.filedeal(request, response,FileConstants.CONTENT_THUMBNAIL);
////	    if(oConvertUtils.isEmpty(v_url)) {
////			j.setSuccess(false);
////			j.setMsg(MutiLangUtil.getLang("sands.uploadError"));
////			return j;
////	    }
////		j.setMsg(MutiLangUtil.getLang("sands.tip.uploadSuc"));
////		j.setObj(v_url);
////		return j;
////	}
////
////
////	/**
////	 * WebUploader 附件上传处理
////	 */
////	@RequestMapping(params = "attachmentUpload")
////	@ResponseBody
////	public AjaxJson attachmentUpload(HttpServletRequest request, HttpServletResponse response) {
////		AjaxJson j = new AjaxJson();
////	    String v_url = Upload.filedeal(request, response,FileConstants.CONTENT_ATTACHMENT);
////	    if(oConvertUtils.isEmpty(v_url)) {
////			j.setSuccess(false);
////			j.setMsg(MutiLangUtil.getLang("sands.uploadError"));
////			return j;
////	    }
////		j.setMsg(MutiLangUtil.getLang("sands.tip.uploadSuc"));
////		j.setObj(v_url);
////		return j;
////	}
////
////
////	/**
////	 * WebUploader 文件上传处理/删除处理
////	 */
////	@RequestMapping(params = "descriotionUpload")
////	@ResponseBody
////	public AjaxJson descriotionUpload(HttpServletRequest request, HttpServletResponse response) {
////		AjaxJson j = new AjaxJson();
////		CKeditorImgUpload u = new CKeditorImgUpload();
////		try{
////		    String v_url = u.imgUpload(request, response,FileConstants.DETAIL);
////			j.setMsg(MutiLangUtil.getLang("sands.tip.uploadSuc"));
////			j.setObj(v_url);
////		}catch (IOException e) {
////			e.printStackTrace();
////			// TODO: handle exception
////		}
////		return j;
////	}
////
////	@RequestMapping(params="updateStatus")
////	@ResponseBody
////	public AjaxJson updateStatus(Integer status,Integer id) {
////		ContentEntity v_content = systemService.get(ContentEntity.class, id);
////		AjaxJson v_json = new AjaxJson();
////		if (oConvertUtils.isEmpty(v_json)) {
////			v_json.setMsg(MutiLangUtil.getLang("sands.tip.inexistence"));
////			return v_json;
////		}
////		v_content.setStatus(status);
////		this.systemService.saveOrUpdate(v_content);
////		v_json.setMsg(MutiLangUtil.getLang("sands.tip.updateRecordSuc"));
////		return v_json;
////	}
////}
